package com.number.app.event;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;

public class UsrSource implements Serializable {

    private static final long serialVersionUID = -8552882299966136960L;
    
    private Vector<IUsrListener> eventVec = new Vector<IUsrListener>();
    
    public void addUsrListener(IUsrListener usrListener) {
        
        eventVec.add(usrListener);
        System.out.println("UsrSource:" + usrListener + "has been added.");
    }
    
    public void notifyUsrEvent(){
        
        IUsrListener usrListener = null;
        
        Enumeration<IUsrListener> enumUsrEvent = eventVec.elements();
        while (enumUsrEvent.hasMoreElements()) {
            usrListener = enumUsrEvent.nextElement();
            usrListener.doEvent(new UsrEvent(this));
        }
    }
    
}
